package com.miyu.book.utils.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.*;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

//@Configuration
public class RedisConfig {
    private final static ResourceBundle resourceBundle = ResourceBundle.getBundle("application");

    //服务器地址
    private  final static  String hostName = resourceBundle.getString("spring.redis.host");
    //对应的配置DB
    private  final static  String dbs = resourceBundle.getString("spring.redis.databases");
    //连接端口
    private  final static  int port = Integer.valueOf(resourceBundle.getString("spring.redis.port"));
    //密码
    private  final static  String passWord = resourceBundle.getString("spring.redis.password");


    //连接池最大连接数（使用负值表示没有限制）
    private  final static  int maxActive = Integer.valueOf(resourceBundle.getString("spring.redis.jedis.pool.max-active"));
    //连接池中的最大空闲连接
    private  final static  int maxWait = Integer.valueOf(resourceBundle.getString("spring.redis.jedis.pool.max-wait"));
    //连接池中的最大空闲连接
    private  final static  int maxIdle = Integer.valueOf(resourceBundle.getString("spring.redis.jedis.pool.max-idle"));
    //连接池中的最小空闲连接
    private  final static  int minIdle = Integer.valueOf(resourceBundle.getString("spring.redis.jedis.pool.min-idle"));
    //连接超时时间
    private  final static  int  timeout = Integer.valueOf(resourceBundle.getString("spring.redis.timeout"));
    //是否启用redis
    private  final static  String enable = resourceBundle.getString("spring.redis.enable");
    public static Map<Integer, RedisTemplate<Serializable, Object>> redisTemplateMap = new HashMap<>();
    //初始化db
    private int defaultDb=0;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;



}

